
const path = require('path');
const fs = require('fs/promises');
const copyDir = require('recursive-copy');
const utils = require('../utils');
const del = require('del');

exports.genSubTasks = (ctx, task) => {
    return [ ];
};

exports.process = async (ctx, task) => {
    const { project } = ctx;

    const files = ctx['files'] || [];

    for (let { filename, filePath } of files) {
        if (['package.json', 'package-lock.json', 'package.json', 'yarn.lock'].includes(filename)) {
            let text = await fs.readFile(filePath, 'utf-8');
            text = text.replaceAll('$PROJ', project);
            await fs.writeFile(filePath, text, 'utf-8');
        }
    }

}